home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # createupdatesets - create the necessary file to support the rlupdate
- # stage 2 / software installer program
- # copyright (c) 2001 Joseph Cheek, Redmond Linux Corp. Released under
- # GPL.
-
- UPDATEBASEDIR=.
- RPMSBASEDIR=.
-
-
- _getrpmlist() {
- #return a list of all RPM files in dir $1
-
- ls "$1/"*.rpm | cat
-
- }
-
-
- _createupdatesets_xml() {
-
-
- __createupdates_header() {
-
- cat << EOF
- <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE updatesets ><updatesets>
- EOF
-
- }
-
-
- __createupdates_body() {
- # create the body for package $1 according to the following pattern:
-
- # <updateset size="15450" name="hwprobe" >
- # <prescript><![CDATA[]]></prescript>
- # <postscript><![CDATA[]]></postscript>
- # <package query="hwprobe" size="15450" arch="i586" action="install"
- # version="0.1-35rl" name="Automatic detection of PCI and ISAPNP devices." >
- # <prescript><![CDATA[]]></prescript>
- # <postscript><![CDATA[]]></postscript>
- # </package>
- # </updateset>
-
- _UP_SIZE=`ls -l $1 | tr -s \ | cut -d \ -f 5`
- _UP_NAME=`rpmextr --tag=name $1`
- _UP_PRE="<![CDATA[]]>"
- _UP_POST="<![CDATA[]]>"
- _PKG_QUERY=`rpmextr --tag=name $1`
- _PKG_SIZE=`ls -l $1 | tr -s \ | cut -d \ -f 5`
- _PKG_ARCH=`echo $1 | tr . \\\\n | tail -n 2 | head -n 1`
- _PKG_ACTION="install"
- _PKG_VERSION=`rpmextr --tag=version $1`-`rpmextr --tag=release $1`
- _PKG_NAME=`rpmextr --tag=summary $1 | sed s/\&/and/g`
- _PKG_PRE="<![CDATA[]]>"
- _PKG_POST="<![CDATA[]]>"
-
- # echo \# $1
-
- cat << EOF
- <updateset size="$_UP_SIZE" name="$_UP_NAME" >
- <prescript>$_UP_PRE</prescript>
- <postscript>$_UP_POST</postscript>
- <package query="$_PKG_QUERY" size="$_PKG_SIZE" arch="$_PKG_ARCH"
- action="$_PKG_ACTION" version="$_PKG_VERSION" name="$_PKG_NAME" >
- <prescript>$_PKG_PRE</prescript>
- <postscript>$_PKG_POST</postscript>
- </package>
- </updateset>
- EOF
-
- }
-
-
- __createupdates_footer() {
-
- cat << EOF
- </updatesets>
- EOF
-
- }
-
- local filename FILES;
-
- __createupdates_header > $UPDATEBASEDIR/updatesets.xml
-
- FILES=`_getrpmlist $RPMSBASEDIR` || return 1
-
- for filename in $FILES; do
- __createupdates_body $filename >> $UPDATEBASEDIR/updatesets.xml
- done
-
- __createupdates_footer >> $UPDATEBASEDIR/updatesets.xml
-
- }
-
-
- _signupdatesets_xml() {
-
- gpg --yes -sb $UPDATEBASEDIR/updatesets.xml || return 1
-
- }
-
-
- _getlatestbuild() {
-
- echo -n What is the latest build \#\?\
- read LATEST_BUILD
-
- }
-
-
- _exit_error() {
-
- echo $* >&2
- exit 1
-
- }
-
-
- # main()
-
- # _getlatestbuild || _exit_error "could not get latest build #"
- _createupdatesets_xml || _exit_error "could not create updatesets.xml file"
- # _signupdatesets_xml || _exit_error "could not sign updatesets.xml file"
-
- exit 0
-